import {makeAutoObservable} from "mobx";

export default class User {
    _userId: string;
    _email: string;
    _roles: string[];
    _username: string;
    userInfoId: string;
    userPhotoId: string | null = null;

    constructor() {
        this._userId = ''
        this._email = ""
        this._roles = new Array<string>()
        this._username = ""
        this.userInfoId = ""
        this.userPhotoId = ""
        makeAutoObservable(this)
    }

    static init(userId: string, email: string, username: string, roles: string[], userInfoId: string, userPhotoId: string | null = null): User {
        let newUser = new User()

        newUser._userId = userId;
        newUser._email = email;
        newUser._username = username;
        newUser.userPhotoId = userPhotoId;
        newUser.userInfoId = userInfoId;
        newUser._roles = roles;

        return newUser
    }

    get roles() {
        return this._roles
    }

    get userId() {
        return this._userId;
    }

    get email() {
        return this._email
    }

    get username() {
        return this._username
    }
}